package com.swas.service.impl;

import com.swas.dao.BaseSurveyDao;
import com.swas.entity.BaseSurvey;
import com.swas.service.BaseSurveyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class BaseSurveyServiceImpl implements BaseSurveyService {
    @Autowired
    private BaseSurveyDao baseSurveyDao;
    @Override
    public List<BaseSurvey> getBaseSurveyAll(Integer id) {
        return baseSurveyDao.getBaseSurveyAll(id);
    }

    @Override
    public boolean addSurvey(BaseSurvey baseSurvey) {
        int i = baseSurveyDao.insertSelective(baseSurvey);
        return i>0;
    }

    @Override
    public boolean updateSurvey(BaseSurvey baseSurvey) {
        return baseSurveyDao.updateByPrimaryKeySelective(baseSurvey)>0;
    }

    @Override
    public boolean delSurvey(Integer id) {
        return baseSurveyDao.deleteByPrimaryKey(id)>0;
    }
}
